None
This notebook processes level 2 images through the calwebb_image3 skymatch and resample steps and examines outputs for different sky method parameters.
Set up data path and image list file.
Set up association files.
Modify average backgrould level of input images.
Run skymatch step on images.
Run skymatch and resample for each skymethod parameter (local, global, match, global+match).
Testing other parameters (nclip, usigma, lsigma, lower, upper, skystat). (Still TBD.)
These steps are set up with simulated MIRI F560W data of the LMC astrometric field. The notebook removes the astrometric field and replaces the field with noise images to help the pipeline testers have a better visualization of what the pipeline is doing with each set of parameters.
This notebook has also been modified to test how skymatch and resample work together (with subtract=True indicating that the subtraction is done in the skymatch step and subtract=False indicating that the subtraction is done in the resample step). There are displays of the combined noise image to see how well the backgrounds were subtracted in the full combined image.
The pipeline documentation can be found here: https://jwst-pipeline.readthedocs.io/en/latest/jwst/skymatch/README.html
The pipeline code is available on GitHub: https://github.com/spacetelescope/jwst/tree/master/jwst/skymatch
Authors: T. Temim and M. Cracraft Last modified: 01/18/2022
# Create a temporary directory to hold notebook output, and change the working directory to that directory.
from tempfile import TemporaryDirectory
import os
data_dir = TemporaryDirectory()
os.chdir(data_dir.name)
# Set up CRDS options
import os
if "CRDS_CACHE_TYPE" in os.environ:
if os.environ['CRDS_CACHE_TYPE'] == 'local':
os.environ['CRDS_PATH'] = os.path.join(os.environ['HOME'], 'crds', 'cache')
elif os.path.isdir(os.environ['CRDS_CACHE_TYPE']):
os.environ['CRDS_PATH'] = os.environ['CRDS_CACHE_TYPE']
The following packages are needed to run this notebook:
import pytest
from astropy.io import fits
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
import jwst
import json
from jwst.skymatch import skymatch
from jwst.resample import ResampleStep
from jwst.pipeline import Image3Pipeline
from jwst.skymatch.skyimage import SkyImage
from jwst.associations.lib.rules_level3_base import DMS_Level3_Base
from jwst.associations import asn_from_list
from jwst import datamodels
from jwst.datamodels import ImageModel
from matplotlib import rcParams
from ci_watson.artifactory_helpers import get_bigdata
jwst.__version__
'1.7.2'
input_file1 = get_bigdata('jwst_validation_notebooks',
'validation_data',
'outlier_detection',
'outlier_detection_miri_test',
'det_image_seq1_MIRIMAGE_F560Wexp1_cal.fits')
input_file2 = get_bigdata('jwst_validation_notebooks',
'validation_data',
'outlier_detection',
'outlier_detection_miri_test',
'det_image_seq2_MIRIMAGE_F560Wexp1_cal.fits')
input_file3 = get_bigdata('jwst_validation_notebooks',
'validation_data',
'outlier_detection',
'outlier_detection_miri_test',
'det_image_seq3_MIRIMAGE_F560Wexp1_cal.fits')
input_file4 = get_bigdata('jwst_validation_notebooks',
'validation_data',
'outlier_detection',
'outlier_detection_miri_test',
'det_image_seq4_MIRIMAGE_F560Wexp1_cal.fits')
input_files=[]
input_files=[input_file1,input_file2,input_file3,input_file4]
imlist1=['det_image_seq1_MIRIMAGE_F560Wexp1_cal.fits','det_image_seq2_MIRIMAGE_F560Wexp1_cal.fits','det_image_seq3_MIRIMAGE_F560Wexp1_cal.fits','det_image_seq4_MIRIMAGE_F560Wexp1_cal.fits']
# Look at one image
im_file = ImageModel('det_image_seq1_MIRIMAGE_F560Wexp1_cal.fits')
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=5)
plt.colorbar()
<matplotlib.colorbar.Colorbar at 0x7f61a7938850>
The level three pipeline relies on an association file to specify which files are to be combined and provide the output file name.
# use asn_from_list to create association table
cal_list=imlist1
asn = asn_from_list.asn_from_list(cal_list, rule=DMS_Level3_Base, product_name='skymatch_combined.fits')
# use this if you need to add non'science' exposure types
#asn['products'][0]['members'][1]['exptype'] = 'background'
#asn['products'][0]['members'][2]['exptype'] = 'sourcecat'
# dump association table to a .json file for use in image3
with open('skymatch_asnfile.json', 'w') as fp:
fp.write(asn.dump()[1])
skymatch_json_file='skymatch_asnfile.json'
json_file = skymatch_json_file
file_list = []
file_list2 = []
with open(json_file) as json_data:
d = json.load(json_data)
members = d['products'][0]['members']
for item in np.arange(0,len(members)):
file_list.append(members[item]['expname'])
file_list2.append(members[item]['expname'][:-5]+"_skymatch.fits")
asn2 = asn_from_list.asn_from_list(file_list2, rule=DMS_Level3_Base, product_name=d['products'][0]['name'])
# use this if you need to add non'science' exposure types
#asn['products'][0]['members'][1]['exptype'] = 'background'
#asn['products'][0]['members'][2]['exptype'] = 'sourcecat'
# dump association table to a .json file for use in image3
with open('skymatch_asnfile2.json', 'w') as fp:
fp.write(asn2.dump()[1])
skymatch_json_file2='skymatch_asnfile2.json'
infile01_1 = input_files[0]
infile01_2 = input_files[1]
infile02_1 = input_files[2]
infile02_2 = input_files[3]
img01_1 = datamodels.open(infile01_1)
img01_2 = datamodels.open(infile01_2)
img02_1 = datamodels.open(infile02_1)
img02_2 = datamodels.open(infile02_2)
data01_1 = img01_1.data
data01_2 = img01_2.data
data02_1 = img02_1.data
data02_2 = img02_2.data
data01_1[data01_1<=0.3]=np.nan
data01_2[data01_2<=0.3]=np.nan
data02_1[data02_1<=0.3]=np.nan
data02_2[data02_2<=0.3]=np.nan
data01_1_orig = np.copy(img01_1.data)
data01_2_orig = np.copy(img01_2.data)
data02_1_orig = np.copy(img02_1.data)
data02_2_orig = np.copy(img02_2.data)
# check mean values of background
print('Mean:', np.mean(data01_1_orig[data01_1_orig<=4.0]),' Standard deviation: ',np.std(data01_1_orig[data01_1_orig<=4.0]))
print('Mean:', np.mean(data01_2_orig[data01_2_orig<=4.0]),' Standard deviation: ',np.std(data01_2_orig[data01_2_orig<=4.0]))
print('Mean:', np.mean(data02_1_orig[data02_1_orig<=4.0]),' Standard deviation: ',np.std(data02_1_orig[data02_1_orig<=4.0]))
print('Mean:', np.mean(data02_2_orig[data02_2_orig<=4.0]),' Standard deviation: ',np.std(data02_2_orig[data02_2_orig<=4.0]))
Mean: 0.93090874 Standard deviation: 0.1817127 Mean: 0.9362799 Standard deviation: 0.17500266 Mean: 0.9330347 Standard deviation: 0.17194116 Mean: 0.93216574 Standard deviation: 0.16481434
# creating a background image with specified mean and gaussian noise with sigma = 1.0
bkg_img_noise_neg2 = np.random.normal(-2,2*0.2,data01_1.shape)
bkg_img_noise_2 = np.random.normal(2,2*0.2,data01_1.shape)
bkg_img_noise_3 = np.random.normal(3,3*0.2,data01_1.shape)
bkg_img_noise_4 = np.random.normal(4,4*0.2,data01_1.shape)
bkg_img_noise_5 = np.random.normal(5,5*0.2,data01_1.shape)
bkg_img_noise_7 = np.random.normal(7,7*0.2,data01_1.shape)
Replace the images with a noise image for easier background visualization
# adding the new background with specified mean and gaussian noise (above) to image (This overwrites, not adds.)
img01_1.data=bkg_img_noise_2
img01_2.data=bkg_img_noise_3
img02_1.data=bkg_img_noise_5
img02_2.data=bkg_img_noise_2
# checking the mean and standard deviations of the new background values
print('Mean:',np.nanmean(img01_1.data),' Standard deviation: ',np.nanstd(img01_1.data))
print('Mean:',np.nanmean(img01_2.data),' Standard deviation: ',np.nanstd(img01_2.data))
print('Mean:',np.nanmean(img02_1.data),' Standard deviation: ',np.nanstd(img02_1.data))
print('Mean:',np.nanmean(img02_2.data),' Standard deviation: ',np.nanstd(img02_2.data))
Mean: 2.0003314 Standard deviation: 0.4004839 Mean: 3.0004618 Standard deviation: 0.60051644 Mean: 4.9998074 Standard deviation: 1.000772 Mean: 2.0003314 Standard deviation: 0.4004839
img01_1.save(file_list2[0],overwrite=True)
img01_2.save(file_list2[1],overwrite=True)
img02_1.save(file_list2[2],overwrite=True)
img02_2.save(file_list2[3],overwrite=True)
'det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits'
# Look at one image
im_file = ImageModel(file_list2[0])
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
<matplotlib.colorbar.Colorbar at 0x7f61a5517160>
Run the pipeline on the data for different sets of parameters
Notes: ‘local’: compute sky background values of each input image or group of images (members of the same “exposure”). A single sky value is computed for each group of images. This method simply computes the mean/median/mode/etc. value of the “sky” separately in each input image. This will resulted in subtracted background being near zero in the combined image, as each image has it's individual background subtracted.
match_down specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True)
'Subtract' specifies whether the computed sky background values are to be subtracted from the images in the skymatch step. (Default = False) Currently, if not done in skymatch, the subtraction is performed in resample.
# skymatch, local, subtract= False, all 4 images used
#jwst.skymatch.skymatch_step.SkyMatchStep.call(skymatch_json_file2, skymethod='local', subtract=False,output_file='MIRI',save_results=True)
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'local' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
match_down = True # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = False # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:38:05,493 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:38:05,494 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:38:05,496 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:38:05,497 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:38:05,498 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:38:05,500 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:38:05,501 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:38:05,712 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:38:05,719 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'local', 'match_down': True, 'subtract': False, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:38:05,856 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:38:06,076 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:38:06,078 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:38:07,018 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:38:07,021 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:38:07,022 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:38:07,031 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:38:07,223 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:38:07,225 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'local', 'match_down': True, 'subtract': False, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:38:07,371 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:07,372 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:38:07.371549
2022-10-06 05:38:07,373 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:07,373 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'local'
2022-10-06 05:38:07,374 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: OFF
2022-10-06 05:38:07,374 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:07,375 - stpipe.Image3Pipeline.skymatch - INFO - ---- Sky values computed per image and/or image groups.
2022-10-06 05:38:07,455 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472
2022-10-06 05:38:07,456 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 2.94921
2022-10-06 05:38:07,457 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 5.01257
2022-10-06 05:38:07,457 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472
2022-10-06 05:38:07,457 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:07,458 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:38:07.457898
2022-10-06 05:38:07,458 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:00.086349
2022-10-06 05:38:07,458 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:07,741 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:38:08,000 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:38:08,256 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:38:08,515 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:38:08,516 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:38:08,743 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:38:08,745 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:38:08,746 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:38:08,755 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:38:08,962 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:38:08,966 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:38:08,983 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:38:09,008 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:38:09,009 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:38:09,009 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:38:09,009 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:38:09,146 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:38:09,794 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:38:10,407 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:11,195 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:11,953 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:12,712 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:12,895 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:38:13,483 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:14,260 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:15,062 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:15,825 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:16,021 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:38:16,621 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:17,429 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:18,257 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:19,063 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:19,270 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:38:19,919 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:20,707 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:21,505 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:22,272 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:22,494 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:38:22,953 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:38:22,954 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:38:23,168 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:38:23,170 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:38:23,171 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:38:23,174 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:38:23,175 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
# Check values out of skymatch step. With subtract = False, values should be equal.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('Original and new levels should be equal. If subtract=False, skymatch should not subtract.')
print('Mean: original, new (local)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
Original and new levels should be equal. If subtract=False, skymatch should not subtract. Mean: original, new (local) Mean: 2.0003314 , 2.0003314 Mean: 3.0004618 , 3.0004618 Mean: 4.9998074 , 4.9998074 Mean: 2.0003314 , 2.0003314
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
print('The resample step should subtract the individual backgrounds found in the skymatch step.')
print('Since the local individual background level is subtracted from each image, final expected result is near zero.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
The resample step should subtract the individual backgrounds found in the skymatch step. Since the local individual background level is subtracted from each image, final expected result is near zero. Mean: 0.008319287
<matplotlib.colorbar.Colorbar at 0x7f619fccb9d0>
Skymatch step should subtract the background. Resample background level should match the skymatch background level since subtraction has already been done
# skymatch, local, subtract = True, all 4 images used
#jwst.skymatch.skymatch_step.SkyMatchStep.call(skymatch_json_file2, skymethod='local', subtract=True,output_file='MIRI',save_results=True)
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'local' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
#match_down = True # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = True # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
#pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:38:24,919 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:38:24,920 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:38:24,922 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:38:24,924 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:38:24,925 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:38:24,927 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:38:24,928 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:38:25,084 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:38:25,090 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'local', 'match_down': True, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:38:25,229 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:38:25,233 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:38:25,235 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:38:25,873 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:38:25,876 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:38:25,876 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:38:25,885 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:38:26,030 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:38:26,032 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'local', 'match_down': True, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:38:26,164 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:26,165 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:38:26.164616
2022-10-06 05:38:26,166 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:26,166 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'local'
2022-10-06 05:38:26,167 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: ON
2022-10-06 05:38:26,168 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:26,168 - stpipe.Image3Pipeline.skymatch - INFO - ---- Sky values computed per image and/or image groups.
2022-10-06 05:38:26,249 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472 (old=0, delta=1.99472)
2022-10-06 05:38:26,251 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 2.94921 (old=0, delta=2.94921)
2022-10-06 05:38:26,253 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 5.01257 (old=0, delta=5.01257)
2022-10-06 05:38:26,255 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472 (old=0, delta=1.99472)
2022-10-06 05:38:26,256 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:26,256 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:38:26.256274
2022-10-06 05:38:26,257 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:00.091658
2022-10-06 05:38:26,257 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:26,532 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:38:26,791 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:38:27,054 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:38:27,312 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:38:27,313 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:38:27,473 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:38:27,475 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:38:27,476 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:38:27,485 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:38:27,637 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:38:27,639 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:38:27,655 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:38:27,677 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:38:27,677 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:38:27,678 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:38:27,679 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:38:27,815 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:38:28,457 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:38:29,058 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:29,842 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:30,629 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:31,400 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:31,587 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:38:32,204 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:32,997 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:33,789 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:34,598 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:34,793 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:38:35,392 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:36,203 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:36,968 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:37,758 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:37,955 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:38:38,562 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:39,357 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:40,184 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:41,073 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:41,294 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:38:41,747 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:38:41,748 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:38:41,948 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:38:41,950 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:38:41,951 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:38:41,954 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:38:41,955 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('With subtract=True, the new value should show that the background value was subtracted.')
print('Mean: original, new (local)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
With subtract=True, the new value should show that the background value was subtracted. Mean: original, new (local) Mean: 2.0003314 , 0.0056128413 Mean: 3.0004618 , 0.051250007 Mean: 4.9998074 , -0.012764158 Mean: 2.0003314 , 0.0056128413
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
print('The background value was subtracted in the skymatch step, no additional subtraction should be done here.')
print('This value should match the values in the new column above.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
The background value was subtracted in the skymatch step, no additional subtraction should be done here. This value should match the values in the new column above. Mean: 0.008319287
<matplotlib.colorbar.Colorbar at 0x7f619ed65910>
This calculates an average sky across all images and subtracts that average from all images. There should be a warning for users for this step that makes it clear that this should not be used on images with differences in background levels.
# skymatch, local
#jwst.skymatch.skymatch_step.SkyMatchStep.call(skymatch_json_file2, skymethod='local', subtract=False,output_file='MIRI',save_results=True)
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'global' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
#match_down = True # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = False # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
#pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:38:43,704 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:38:43,706 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:38:43,707 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:38:43,709 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:38:43,710 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:38:43,711 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:38:43,713 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:38:43,931 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:38:43,938 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'global', 'match_down': True, 'subtract': False, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:38:44,075 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:38:44,082 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:38:44,083 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:38:44,747 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:38:44,749 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:38:44,750 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:38:44,758 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:38:44,921 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:38:44,923 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'global', 'match_down': True, 'subtract': False, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:38:45,051 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:45,052 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:38:45.051922
2022-10-06 05:38:45,053 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:45,053 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'global'
2022-10-06 05:38:45,053 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: OFF
2022-10-06 05:38:45,054 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:45,054 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing "global" sky - smallest sky value across *all* input images.
2022-10-06 05:38:45,135 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:45,136 - stpipe.Image3Pipeline.skymatch - INFO - "Global" sky value correction: 1.9947187536830413 [not converted]
2022-10-06 05:38:45,136 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472
2022-10-06 05:38:45,136 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472
2022-10-06 05:38:45,137 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472
2022-10-06 05:38:45,137 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472
2022-10-06 05:38:45,137 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:45,138 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:38:45.137910
2022-10-06 05:38:45,138 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:00.085988
2022-10-06 05:38:45,138 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:38:45,410 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:38:45,656 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:38:45,904 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:38:46,158 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:38:46,159 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:38:46,338 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:38:46,340 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:38:46,340 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:38:46,349 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:38:46,509 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:38:46,511 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:38:46,526 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:38:46,546 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:38:46,547 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:38:46,547 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:38:46,548 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:38:46,678 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:38:47,310 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:38:47,922 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:48,720 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:49,534 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:50,314 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:50,500 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:38:51,086 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:51,875 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:52,685 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:53,477 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:53,670 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:38:54,280 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:55,079 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:55,874 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:56,649 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:56,846 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:38:57,431 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:58,210 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:58,964 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:59,721 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:38:59,950 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:39:00,405 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:39:00,407 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:39:00,621 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:39:00,622 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:39:00,623 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:39:00,626 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:39:00,627 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('There should be no subtraction at this step, with subtraction = False.')
print('Mean: original, new (local)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
There should be no subtraction at this step, with subtraction = False. Mean: original, new (local) Mean: 2.0003314 , 2.0003314 Mean: 3.0004618 , 3.0004618 Mean: 4.9998074 , 4.9998074 Mean: 2.0003314 , 2.0003314
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
print('Global finds a single value for the background, and subtracts that value from all images.')
print('The value listed here should be the average of the subtracted sky values across images.')
print('The combined image will look messy as the same value was subtracted from the image with background = 5')
print('and from the images with background = 2. This shows the differing backgrounds strongly.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
Global finds a single value for the background, and subtracts that value from all images. The value listed here should be the average of the subtracted sky values across images. The combined image will look messy as the same value was subtracted from the image with background = 5 and from the images with background = 2. This shows the differing backgrounds strongly. Mean: 1.0015472
<matplotlib.colorbar.Colorbar at 0x7f619e3e5f40>
# skymatch, global, subtract = True
#jwst.skymatch.skymatch_step.SkyMatchStep.call(skymatch_json_file2, skymethod='global', subtract=True,output_file='MIRI',save_results=True)
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'global' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
#match_down = True # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = True # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
#pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:39:02,394 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:39:02,395 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:39:02,397 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:39:02,399 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:39:02,400 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:39:02,402 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:39:02,403 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:39:02,639 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:39:02,646 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'global', 'match_down': True, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:39:02,787 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:39:02,789 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:39:02,792 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:39:03,491 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:39:03,494 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:39:03,494 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:39:03,504 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:39:03,688 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:39:03,689 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'global', 'match_down': True, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:39:03,826 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:03,827 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:39:03.826763
2022-10-06 05:39:03,828 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:03,828 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'global'
2022-10-06 05:39:03,828 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: ON
2022-10-06 05:39:03,829 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:03,829 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing "global" sky - smallest sky value across *all* input images.
2022-10-06 05:39:03,911 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:03,912 - stpipe.Image3Pipeline.skymatch - INFO - "Global" sky value correction: 1.9947187536830413 [not converted]
2022-10-06 05:39:03,914 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472 (old=0, delta=1.99472)
2022-10-06 05:39:03,916 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472 (old=0, delta=1.99472)
2022-10-06 05:39:03,918 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472 (old=0, delta=1.99472)
2022-10-06 05:39:03,920 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.99472 (old=0, delta=1.99472)
2022-10-06 05:39:03,920 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:03,920 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:39:03.920358
2022-10-06 05:39:03,921 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:00.093595
2022-10-06 05:39:03,921 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:04,202 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:39:04,457 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:39:04,703 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:39:04,950 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:39:04,951 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:39:05,147 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:39:05,148 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:39:05,149 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:39:05,158 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:39:05,337 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:39:05,339 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:39:05,355 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:39:05,378 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:39:05,378 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:39:05,378 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:39:05,379 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:39:05,520 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:39:06,184 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:39:06,787 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:07,588 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:08,388 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:09,194 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:09,377 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:39:09,989 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:10,758 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:11,552 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:12,340 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:12,544 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:39:13,120 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:13,923 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:14,799 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:15,607 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:15,829 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:39:16,410 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:17,175 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:17,948 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:18,729 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:18,957 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:39:19,413 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:39:19,415 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:39:19,641 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:39:19,643 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:39:19,644 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:39:19,647 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:39:19,648 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('Global finds a single value for the background, and subtracts that value from all images.')
print('The values listed here should be the average of the subtracted sky values across images subtracted from each image.')
print('Mean: original, new (global)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
Global finds a single value for the background, and subtracts that value from all images. The values listed here should be the average of the subtracted sky values across images subtracted from each image. Mean: original, new (global) Mean: 2.0003314 , 0.0056128413 Mean: 3.0004618 , 1.005743 Mean: 4.9998074 , 3.005088 Mean: 2.0003314 , 0.0056128413
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
print('Global finds a single value for the background, and subtracts that value from all images.')
print('The value listed here should be the average of the subtracted sky values across images.')
print('The combined image will look messy as the same value was subtracted from the image with background = 5')
print('and from the images with background = 2. This shows the differing backgrounds strongly.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
Global finds a single value for the background, and subtracts that value from all images. The value listed here should be the average of the subtracted sky values across images. The combined image will look messy as the same value was subtracted from the image with background = 5 and from the images with background = 2. This shows the differing backgrounds strongly. Mean: 1.0015472
<matplotlib.colorbar.Colorbar at 0x7f619de0d7f0>
Based on whether match_down is set to True or False, Match will calculate the difference between the lowest background level or highest level (respectively), and subtract the difference between the calculated level and the 'matched' level.
This is the preferred default option as it subtracts the differences between the background levels, normalizing all of the backgrounds to a common level (either lowest or highest background), rather than subtracting off all of the background.
# skymatch, match down, subtract = True
#jwst.skymatch.skymatch_step.SkyMatchStep.call(skymatch_json_file2, skymethod='match', match_down=True,subtract=True,output_file='MIRI',save_results=True)
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'match' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
match_down = True # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = True # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:39:21,418 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:39:21,420 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:39:21,422 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:39:21,423 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:39:21,424 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:39:21,426 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:39:21,427 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:39:21,681 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:39:21,688 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'match', 'match_down': True, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:39:21,834 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:39:21,836 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:39:21,839 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:39:22,558 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:39:22,560 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:39:22,561 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:39:22,570 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:39:22,760 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:39:22,762 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'match', 'match_down': True, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:39:22,894 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:22,895 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:39:22.894347
2022-10-06 05:39:22,895 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:22,895 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'match'
2022-10-06 05:39:22,896 - stpipe.Image3Pipeline.skymatch - INFO - Sky matching direction: DOWN
2022-10-06 05:39:22,896 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: ON
2022-10-06 05:39:22,896 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:22,897 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing differences in sky values in overlapping regions.
2022-10-06 05:39:25,332 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0.000157955 (old=0, delta=0.000157955)
2022-10-06 05:39:25,335 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0.962881 (old=0, delta=0.962881)
2022-10-06 05:39:25,337 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 3.01641 (old=0, delta=3.01641)
2022-10-06 05:39:25,339 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0 (old=0, delta=0)
2022-10-06 05:39:25,339 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:25,339 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:39:25.339536
2022-10-06 05:39:25,340 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:02.445189
2022-10-06 05:39:25,340 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:25,619 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:39:25,876 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:39:26,132 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:39:26,383 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:39:26,384 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:39:26,600 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:39:26,602 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:39:26,602 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:39:26,612 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:39:26,806 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:39:26,807 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:39:26,824 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:39:26,845 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:39:26,846 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:39:26,846 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:39:26,847 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:39:26,984 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:39:27,626 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:39:28,241 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:29,028 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:29,814 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:30,567 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:30,751 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:39:31,343 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:32,127 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:32,914 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:33,703 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:33,901 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:39:34,503 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:35,314 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:36,094 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:36,884 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:37,077 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:39:37,657 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:38,424 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:39,177 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:39,942 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:40,165 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:39:40,607 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:39:40,608 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:39:40,817 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:39:40,818 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:39:40,819 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:39:40,822 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:39:40,822 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('There should be no subtraction at this step, with subtraction = False.')
print('Mean: original, new (match down)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
There should be no subtraction at this step, with subtraction = False. Mean: original, new (match down) Mean: 2.0003314 , 2.0001736 Mean: 3.0004618 , 2.0375805 Mean: 4.9998074 , 1.9834005 Mean: 2.0003314 , 2.0003314
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
print('For the method match with match_down= True, the value of the background should match the minimum of the individual backgrounds.')
print('This value should match the values in the new column above. Subtraction was done in skymatch step.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
For the method match with match_down= True, the value of the background should match the minimum of the individual backgrounds. This value should match the values in the new column above. Subtraction was done in skymatch step. Mean: 2.0012608
<matplotlib.colorbar.Colorbar at 0x7f619dadbbe0>
# skymatch, match up, subtract = True
#jwst.skymatch.skymatch_step.SkyMatchStep.call(skymatch_json_file2, skymethod='match', match_down=False,subtract=True,output_file='MIRI',save_results=True)
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'match' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
match_down = False # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = True # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:39:42,570 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:39:42,571 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:39:42,573 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:39:42,574 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:39:42,576 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:39:42,577 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:39:42,578 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:39:42,824 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:39:42,830 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'match', 'match_down': False, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:39:42,966 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:39:42,968 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:39:42,970 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:39:43,664 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:39:43,666 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:39:43,667 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:39:43,675 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:39:43,867 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:39:43,869 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'match', 'match_down': False, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:39:43,999 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:44,000 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:39:43.999716
2022-10-06 05:39:44,001 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:44,001 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'match'
2022-10-06 05:39:44,001 - stpipe.Image3Pipeline.skymatch - INFO - Sky matching direction: UP
2022-10-06 05:39:44,002 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: ON
2022-10-06 05:39:44,002 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:44,002 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing differences in sky values in overlapping regions.
2022-10-06 05:39:46,463 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: -3.01625 (old=0, delta=-3.01625)
2022-10-06 05:39:46,465 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: -2.05353 (old=0, delta=-2.05353)
2022-10-06 05:39:46,467 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0 (old=0, delta=0)
2022-10-06 05:39:46,469 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: -3.01641 (old=0, delta=-3.01641)
2022-10-06 05:39:46,469 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:46,470 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:39:46.469908
2022-10-06 05:39:46,470 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:02.470192
2022-10-06 05:39:46,470 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:39:46,748 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:39:47,004 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:39:47,249 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:39:47,493 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:39:47,494 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:39:47,714 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:39:47,716 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:39:47,717 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:39:47,726 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:39:47,918 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:39:47,920 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:39:47,939 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:39:47,960 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:39:47,960 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:39:47,960 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:39:47,961 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:39:48,090 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:39:48,715 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:39:49,304 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:50,091 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:50,870 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:51,634 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:51,817 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:39:52,400 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:53,148 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:53,894 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:54,671 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:54,866 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:39:55,427 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:56,180 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:56,945 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:57,720 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:57,912 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:39:58,484 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:59,241 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:39:59,994 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:00,739 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:00,956 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:40:01,398 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:40:01,399 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:40:01,600 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:40:01,602 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:40:01,602 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:40:01,605 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:40:01,606 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('With match_down = False, match will match the backgrounds of all to the highest background.')
print('With subtract = True, the background matching is done at the skymatch step.')
print('Mean: original, new (match up)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
With match_down = False, match will match the backgrounds of all to the highest background. With subtract = True, the background matching is done at the skymatch step. Mean: original, new (match up) Mean: 2.0003314 , 5.01658 Mean: 3.0004618 , 5.0539856 Mean: 4.9998074 , 4.9998074 Mean: 2.0003314 , 5.016739
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
print('For the method match with match_down=False, the value of the background should match the maximum of the individual backgrounds')
print('This value should match the values in the new column above. Subtraction was done in skymatch step.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
For the method match with match_down=False, the value of the background should match the maximum of the individual backgrounds This value should match the values in the new column above. Subtraction was done in skymatch step. Mean: 5.0176673
<matplotlib.colorbar.Colorbar at 0x7f619d74d1f0>
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'match' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
match_down = True # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = False # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:40:02,966 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:40:02,968 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:40:02,970 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:40:02,971 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:40:02,972 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:40:02,974 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:40:02,975 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:40:03,232 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:40:03,239 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'match', 'match_down': True, 'subtract': False, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:40:03,372 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:40:03,375 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:40:03,378 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:40:04,057 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:40:04,060 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:40:04,061 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:40:04,070 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:40:04,253 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:40:04,255 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'match', 'match_down': True, 'subtract': False, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:40:04,382 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:04,383 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:40:04.382528
2022-10-06 05:40:04,384 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:04,384 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'match'
2022-10-06 05:40:04,385 - stpipe.Image3Pipeline.skymatch - INFO - Sky matching direction: DOWN
2022-10-06 05:40:04,385 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: OFF
2022-10-06 05:40:04,386 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:04,386 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing differences in sky values in overlapping regions.
2022-10-06 05:40:06,818 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0.000157955
2022-10-06 05:40:06,819 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0.962881
2022-10-06 05:40:06,820 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 3.01641
2022-10-06 05:40:06,821 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0
2022-10-06 05:40:06,821 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:06,822 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:40:06.821910
2022-10-06 05:40:06,822 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:02.439382
2022-10-06 05:40:06,823 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:07,089 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:40:07,332 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:40:07,573 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:40:07,815 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:40:07,816 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:40:08,027 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:40:08,030 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:40:08,031 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:40:08,040 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:40:08,228 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:40:08,230 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:40:08,246 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:40:08,266 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:40:08,267 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:40:08,267 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:40:08,268 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:40:08,394 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:40:09,014 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:40:09,599 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:10,354 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:11,114 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:11,876 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:12,060 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:40:12,644 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:13,406 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:14,218 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:14,963 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:15,194 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:40:15,789 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:16,574 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:17,595 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:18,619 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:18,895 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:40:19,537 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:20,302 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:21,051 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:21,821 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:22,041 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:40:22,481 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:40:22,482 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:40:22,689 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:40:22,691 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:40:22,692 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:40:22,694 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:40:22,695 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('With subtract=False, no subtraction should be done here.')
print('Mean: original, new (match down)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
With subtract=False, no subtraction should be done here. Mean: original, new (match down) Mean: 2.0003314 , 2.0003314 Mean: 3.0004618 , 3.0004618 Mean: 4.9998074 , 4.9998074 Mean: 2.0003314 , 2.0003314
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
print('With the match method, subtract=False and match_down=True, the background value should match to the lowest individual background.')
print('This value should match the minimum values in the new column above.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
With the match method, subtract=False and match_down=True, the background value should match to the lowest individual background. This value should match the minimum values in the new column above. Mean: 2.0012608
<matplotlib.colorbar.Colorbar at 0x7f619d34e760>
The behavior of this step is that it subtracts all background. More documentation is needed on how exactly it gets to that point.
# skymatch, global+match, subtract = True
#jwst.skymatch.skymatch_step.SkyMatchStep.call(skymatch_json_file2, skymethod='global+match', match_down=True,subtract=True,output_file='MIRI',save_results=True)
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'global+match' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
#match_down = True # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = True # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
#pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:40:24,443 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:40:24,445 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:40:24,446 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:40:24,448 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:40:24,449 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:40:24,450 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:40:24,452 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:40:24,992 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:40:24,998 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'global+match', 'match_down': True, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:40:25,132 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:40:25,135 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:40:25,137 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:40:25,868 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:40:25,870 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:40:25,871 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:40:25,879 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:40:26,080 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:40:26,082 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'global+match', 'match_down': True, 'subtract': True, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:40:26,211 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:26,212 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:40:26.211892
2022-10-06 05:40:26,212 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:26,213 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'global+match'
2022-10-06 05:40:26,213 - stpipe.Image3Pipeline.skymatch - INFO - Sky matching direction: DOWN
2022-10-06 05:40:26,214 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: ON
2022-10-06 05:40:26,214 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:26,214 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing differences in sky values in overlapping regions.
2022-10-06 05:40:28,646 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0.000157955 (old=0, delta=0.000157955)
2022-10-06 05:40:28,650 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0.962881 (old=0, delta=0.962881)
2022-10-06 05:40:28,651 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 3.01641 (old=0, delta=3.01641)
2022-10-06 05:40:28,654 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0 (old=0, delta=0)
2022-10-06 05:40:28,654 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:28,654 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing "global" sky - smallest sky value across *all* input images.
2022-10-06 05:40:28,730 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:28,731 - stpipe.Image3Pipeline.skymatch - INFO - "Global" sky value correction: 1.986330113869447 [not converted]
2022-10-06 05:40:28,731 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:28,731 - stpipe.Image3Pipeline.skymatch - INFO - ---- Final (match+global) sky for:
2022-10-06 05:40:28,733 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.98649 (old=0.000157955, delta=1.98633)
2022-10-06 05:40:28,734 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 2.94921 (old=0.962881, delta=1.98633)
2022-10-06 05:40:28,735 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 5.00274 (old=3.01641, delta=1.98633)
2022-10-06 05:40:28,736 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.98633 (old=0, delta=1.98633)
2022-10-06 05:40:28,736 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:28,737 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:40:28.736903
2022-10-06 05:40:28,737 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:02.525011
2022-10-06 05:40:28,737 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:29,012 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:40:29,259 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:40:29,506 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:40:29,752 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:40:29,753 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:40:29,981 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:40:29,982 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:40:29,983 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:40:29,992 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:40:30,193 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:40:30,195 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:40:30,212 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:40:30,232 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:40:30,233 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:40:30,233 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:40:30,233 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:40:30,361 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:40:30,984 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:40:31,662 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:32,629 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:33,632 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:34,563 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:34,766 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:40:35,500 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:36,462 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:37,393 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:38,373 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:38,614 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:40:39,300 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:40,159 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:40,916 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:41,871 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:42,069 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:40:42,649 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:43,488 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:44,434 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:45,356 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:45,605 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:40:46,128 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:40:46,129 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:40:46,685 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:40:46,687 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:40:46,688 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:40:46,691 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:40:46,693 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('Mean: original, new (global+match)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
Mean: original, new (global+match) Mean: 2.0003314 , 0.013843469 Mean: 3.0004618 , 0.05125014 Mean: 4.9998074 , -0.002929958 Mean: 2.0003314 , 0.01400148
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
#print('Did resample subtract a background level, and what was it?')
print('This value should match the values in the new column above. Subtraction was done in skymatch step.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
This value should match the values in the new column above. Subtraction was done in skymatch step. Mean: 0.014930522
<matplotlib.colorbar.Colorbar at 0x7f619cdf6820>
# Test running just skymatch and resample and skiping other steps.
# Run Calwebb_image3 on the association table
# set any specific parameters
skymethod = 'global+match' # sky computation algorithm to be used. Allowed values: {local, global, match, global+match} (Default = global+match
#match_down = True # Specifies whether the sky differences should be subtracted from images with higher sky values (match_down = True) in order to match the image with the lowest sky or sky differences should be added to the images with lower sky values to match the sky of the image with the highest sky value (match_down = False). (Default = True
subtract = False # Specifies whether the computed sky background values are to be subtracted from the images. (Default = False
pipe3=Image3Pipeline()
pipe3.tweakreg.skip = True
pipe3.outlier_detection.skip = True
pipe3.source_catalog.skip = True
pipe3.skymatch.skymethod = skymethod
#pipe3.skymatch.match_down = match_down
pipe3.skymatch.subtract = subtract
pipe3.skymatch.output_file = 'MIRI'
pipe3.skymatch.save_results = True
pipe3.resample.save_results = True
pipe3.save_results = True
# run Image3
image = pipe3.run(skymatch_json_file2)
print('Image 3 pipeline finished.')
2022-10-06 05:40:48,688 - stpipe.Image3Pipeline - INFO - Image3Pipeline instance created.
2022-10-06 05:40:48,690 - stpipe.Image3Pipeline.assign_mtwcs - INFO - AssignMTWcsStep instance created.
2022-10-06 05:40:48,692 - stpipe.Image3Pipeline.tweakreg - INFO - TweakRegStep instance created.
2022-10-06 05:40:48,693 - stpipe.Image3Pipeline.skymatch - INFO - SkyMatchStep instance created.
2022-10-06 05:40:48,694 - stpipe.Image3Pipeline.outlier_detection - INFO - OutlierDetectionStep instance created.
2022-10-06 05:40:48,696 - stpipe.Image3Pipeline.resample - INFO - ResampleStep instance created.
2022-10-06 05:40:48,697 - stpipe.Image3Pipeline.source_catalog - INFO - SourceCatalogStep instance created.
2022-10-06 05:40:49,036 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline running with args ('skymatch_asnfile2.json',).
2022-10-06 05:40:49,043 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'steps': {'assign_mtwcs': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': False, 'suffix': 'assign_mtwcs', 'search_output_file': True, 'input_dir': ''}, 'tweakreg': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}, 'skymatch': {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'global+match', 'match_down': True, 'subtract': False, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}, 'outlier_detection': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}, 'resample': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}, 'source_catalog': {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}}}
2022-10-06 05:40:49,176 - stpipe.Image3Pipeline - INFO - Prefetching reference files for dataset: 'det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits' reftypes = ['drizpars']
2022-10-06 05:40:49,183 - stpipe.Image3Pipeline - INFO - Prefetch for DRIZPARS reference file is '/grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits'.
2022-10-06 05:40:49,185 - stpipe.Image3Pipeline - INFO - Starting calwebb_image3 ...
2022-10-06 05:40:49,911 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg running with args (<ModelContainer>,).
2022-10-06 05:40:49,913 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': True, 'output_use_index': True, 'save_results': False, 'skip': True, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'save_catalogs': False, 'catalog_format': 'ecsv', 'kernel_fwhm': 2.5, 'snr_threshold': 10.0, 'sharplo': 0.2, 'sharphi': 1.0, 'roundlo': -1.0, 'roundhi': 1.0, 'brightest': 200, 'peakmax': None, 'bkg_boxsize': 400, 'enforce_user_order': False, 'expand_refcat': False, 'minobj': 15, 'searchrad': 2.0, 'use2dhist': True, 'separation': 1.0, 'tolerance': 0.7, 'xoffset': 0.0, 'yoffset': 0.0, 'fitgeometry': 'rshift', 'nclip': 3, 'sigma': 3.0, 'abs_refcat': '', 'save_abs_catalog': False, 'abs_minobj': 15, 'abs_searchrad': 6.0, 'abs_use2dhist': True, 'abs_separation': 0.1, 'abs_tolerance': 0.7, 'abs_fitgeometry': 'rshift', 'abs_nclip': 3, 'abs_sigma': 3.0}
2022-10-06 05:40:49,914 - stpipe.Image3Pipeline.tweakreg - INFO - Step skipped.
2022-10-06 05:40:49,922 - stpipe.Image3Pipeline.tweakreg - INFO - Step tweakreg done
2022-10-06 05:40:50,151 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch running with args (<ModelContainer>,).
2022-10-06 05:40:50,153 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': '/internal/data1/jenkins/workspace/Notebooks/jwst_validation_notebooks_spacetelescope/tmp/tmp2z5wybxq/MIRI', 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': None, 'search_output_file': True, 'input_dir': '', 'skymethod': 'global+match', 'match_down': True, 'subtract': False, 'stepsize': None, 'skystat': 'mode', 'dqbits': '~DO_NOT_USE+NON_SCIENCE', 'lower': None, 'upper': None, 'nclip': 5, 'lsigma': 4.0, 'usigma': 4.0, 'binwidth': 0.1}
2022-10-06 05:40:50,283 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:50,284 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() started on 2022-10-06 05:40:50.283592
2022-10-06 05:40:50,284 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:50,285 - stpipe.Image3Pipeline.skymatch - INFO - Sky computation method: 'global+match'
2022-10-06 05:40:50,285 - stpipe.Image3Pipeline.skymatch - INFO - Sky matching direction: DOWN
2022-10-06 05:40:50,285 - stpipe.Image3Pipeline.skymatch - INFO - Sky subtraction from image data: OFF
2022-10-06 05:40:50,286 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:50,286 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing differences in sky values in overlapping regions.
2022-10-06 05:40:52,714 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0.000157955
2022-10-06 05:40:52,715 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0.962881
2022-10-06 05:40:52,716 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 3.01641
2022-10-06 05:40:52,716 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 0
2022-10-06 05:40:52,716 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:52,717 - stpipe.Image3Pipeline.skymatch - INFO - ---- Computing "global" sky - smallest sky value across *all* input images.
2022-10-06 05:40:52,794 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:52,795 - stpipe.Image3Pipeline.skymatch - INFO - "Global" sky value correction: 1.9863300993845658 [not converted]
2022-10-06 05:40:52,795 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:52,796 - stpipe.Image3Pipeline.skymatch - INFO - ---- Final (match+global) sky for:
2022-10-06 05:40:52,796 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq1_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.98649 (old=0.000157955, delta=1.98633)
2022-10-06 05:40:52,796 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq2_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 2.94921 (old=0.962881, delta=1.98633)
2022-10-06 05:40:52,797 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq3_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 5.00274 (old=3.01641, delta=1.98633)
2022-10-06 05:40:52,797 - stpipe.Image3Pipeline.skymatch - INFO - * Image ID=det_image_seq4_MIRIMAGE_F560Wexp1_cal_skymatch.fits. Sky background: 1.98633 (old=0, delta=1.98633)
2022-10-06 05:40:52,797 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:52,798 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() ended on 2022-10-06 05:40:52.797864
2022-10-06 05:40:52,798 - stpipe.Image3Pipeline.skymatch - INFO - ***** jwst.skymatch.skymatch.match() TOTAL RUN TIME: 0:00:02.514272
2022-10-06 05:40:52,798 - stpipe.Image3Pipeline.skymatch - INFO -
2022-10-06 05:40:53,076 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_0_skymatch.fits
2022-10-06 05:40:53,327 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_1_skymatch.fits
2022-10-06 05:40:53,569 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_2_skymatch.fits
2022-10-06 05:40:53,815 - stpipe.Image3Pipeline.skymatch - INFO - Saved model in MIRI_3_skymatch.fits
2022-10-06 05:40:53,816 - stpipe.Image3Pipeline.skymatch - INFO - Step skymatch done
2022-10-06 05:40:54,077 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection running with args (<ModelContainer>,).
2022-10-06 05:40:54,078 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'crf', 'search_output_file': False, 'input_dir': '', 'weight_type': 'ivm', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'nlow': 0, 'nhigh': 0, 'maskpt': 0.7, 'grow': 1, 'snr': '5.0 4.0', 'scale': '1.2 0.7', 'backg': 0.0, 'save_intermediate_results': False, 'resample_data': True, 'good_bits': '~DO_NOT_USE', 'scale_detection': False, 'allowed_memory': None, 'in_memory': False}
2022-10-06 05:40:54,079 - stpipe.Image3Pipeline.outlier_detection - INFO - Step skipped.
2022-10-06 05:40:54,088 - stpipe.Image3Pipeline.outlier_detection - INFO - Step outlier_detection done
2022-10-06 05:40:54,332 - stpipe.Image3Pipeline.resample - INFO - Step resample running with args (<ModelContainer>,).
2022-10-06 05:40:54,334 - stpipe.Image3Pipeline.resample - INFO - Step resample parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': False, 'suffix': 'i2d', 'search_output_file': True, 'input_dir': '', 'pixfrac': 1.0, 'kernel': 'square', 'fillval': 'INDEF', 'weight_type': 'ivm', 'output_shape': None, 'crpix': None, 'crval': None, 'rotation': None, 'pixel_scale_ratio': 1.0, 'pixel_scale': None, 'single': False, 'blendheaders': True, 'allowed_memory': None, 'in_memory': True}
2022-10-06 05:40:54,351 - stpipe.Image3Pipeline.resample - INFO - Drizpars reference file: /grp/crds/cache/references/jwst/jwst_miri_drizpars_0001.fits
2022-10-06 05:40:54,372 - stpipe.Image3Pipeline.resample - INFO - Driz parameter kernel: square
2022-10-06 05:40:54,372 - stpipe.Image3Pipeline.resample - INFO - Driz parameter pixfrac: 1.0
2022-10-06 05:40:54,373 - stpipe.Image3Pipeline.resample - INFO - Driz parameter fillval: INDEF
2022-10-06 05:40:54,373 - stpipe.Image3Pipeline.resample - INFO - Driz parameter weight_type: ivm
2022-10-06 05:40:54,504 - stpipe.Image3Pipeline.resample - INFO - Blending metadata for skymatch_combined.fits
2022-10-06 05:40:55,133 - stpipe.Image3Pipeline.resample - INFO - Resampling science data
2022-10-06 05:40:55,778 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:56,564 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:57,344 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:58,126 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:58,311 - stpipe.Image3Pipeline.resample - INFO - Resampling var_rnoise
2022-10-06 05:40:58,900 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:40:59,709 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:00,515 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:01,329 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:01,530 - stpipe.Image3Pipeline.resample - INFO - Resampling var_poisson
2022-10-06 05:41:02,144 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:02,939 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:03,699 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:04,500 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:04,695 - stpipe.Image3Pipeline.resample - INFO - Resampling var_flat
2022-10-06 05:41:05,275 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:06,050 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:06,831 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:07,599 - stpipe.Image3Pipeline.resample - INFO - Drizzling (1024, 1032) --> (1149, 1118)
2022-10-06 05:41:07,820 - stpipe.Image3Pipeline.resample - INFO - Update S_REGION to POLYGON ICRS 0.020232898 -0.018692220 0.023327823 0.016575172 359.989011943 0.019586596 359.985917018 -0.015680796
2022-10-06 05:41:08,258 - stpipe.Image3Pipeline.resample - INFO - Saved model in skymatch_combined_i2d.fits
2022-10-06 05:41:08,259 - stpipe.Image3Pipeline.resample - INFO - Step resample done
2022-10-06 05:41:08,511 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog running with args (<ImageModel(1149, 1118) from skymatch_combined_i2d.fits>,).
2022-10-06 05:41:08,513 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog parameters are: {'pre_hooks': [], 'post_hooks': [], 'output_file': None, 'output_dir': None, 'output_ext': '.fits', 'output_use_model': False, 'output_use_index': True, 'save_results': True, 'skip': True, 'suffix': 'cat', 'search_output_file': True, 'input_dir': '', 'bkg_boxsize': 1000, 'kernel_fwhm': 2.0, 'snr_threshold': 3.0, 'npixels': 25, 'deblend': False, 'aperture_ee1': 30, 'aperture_ee2': 50, 'aperture_ee3': 70, 'ci1_star_threshold': 2.0, 'ci2_star_threshold': 1.8}
2022-10-06 05:41:08,514 - stpipe.Image3Pipeline.source_catalog - INFO - Step skipped.
2022-10-06 05:41:08,517 - stpipe.Image3Pipeline.source_catalog - INFO - Step source_catalog done
2022-10-06 05:41:08,518 - stpipe.Image3Pipeline - INFO - Step Image3Pipeline done
Image 3 pipeline finished.
img01_1_new = datamodels.open('MIRI_0_skymatch.fits')
img01_2_new = datamodels.open('MIRI_1_skymatch.fits')
img02_1_new = datamodels.open('MIRI_2_skymatch.fits')
img02_2_new = datamodels.open('MIRI_3_skymatch.fits')
print('Mean: original, new (global+match)')
print('Mean:',np.mean(img01_1.data),',', np.mean(img01_1_new.data))
print('Mean:',np.mean(img01_2.data),',', np.mean(img01_2_new.data))
print('Mean:',np.mean(img02_1.data),',', np.mean(img02_1_new.data))
print('Mean:',np.mean(img02_2.data),',', np.mean(img02_2_new.data))
Mean: original, new (global+match) Mean: 2.0003314 , 2.0003314 Mean: 3.0004618 , 3.0004618 Mean: 4.9998074 , 4.9998074 Mean: 2.0003314 , 2.0003314
# Look at combined image
im_file = ImageModel('skymatch_combined_i2d.fits')
print('Did resample subtract a background level, and what was it?')
#print('This value should match the values in the new column above. Subtraction was done in skymatch step.')
print('Mean:',np.mean(im_file.data[600:700,600:700]))
# read in ecsv photom file
from astropy.visualization import LogStretch, PercentileInterval, ManualInterval
#viz2 = LogStretch() + ManualInterval(0,10)
plt.figure(figsize=(20,20))
#plt.imshow(viz2(im_file.data), origin='lower')
plt.imshow(im_file.data, origin='lower', cmap='rainbow', vmin=0, vmax=4)
plt.colorbar()
Did resample subtract a background level, and what was it? Mean: 0.014930537
<matplotlib.colorbar.Colorbar at 0x7f619caa3eb0>